<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <title>二级科室管理</title>
    <%@ include file="../common/meta.jsp" %>
    <link href="${ctx}/css/page/common-list.css?t=${now}" rel="stylesheet">
    <link href="${ctx}/css/page/common-search.css?t=${now}" rel="stylesheet">
    <script src="${ctx}/js/plugins/validate/jquery.validate.custom.js?t=20181024"></script>
    <style>
    </style>
    <script>
        var deptCode = '${deptCode}';
        var searchInfo = ${searchInfo};
    </script>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="tabs-container">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5><i class="fa fa-search"></i> 筛选查询</h5>
                    </div>
                    <div class="ibox-content ibox-content-search">
                        <form class="form-horizontal m-t" id="searchForm" novalidate="novalidate"
                              action="${ctx}/pfUser/getGridData" target="formIframeName" method="post">
                            <div class="form-group">
                                <input type="hidden" name="parentCode" value="${deptCode}">
                                <label class="col-sm-1 control-label">查询科室：</label>
                                <div class="col-sm-5">
                                    <input type="text" name="deptName" value="${not empty searchInfo ? searchInfo.deptName : ''}" onkeydown="if(event.keyCode==13){doRefresh();return false;}" id="deptName" class="form-control"  placeholder="输入科室名称" maxlength="20">
                                </div>
                                <label class="col-sm-1 control-label">状态：</label>
                                <div class="col-sm-2">
                                    <select class="form-control" name="status" id="status" onchange="doRefresh()">
                                        <option value="">--请选择--</option>
                                        <c:forEach items="${statusMap}" var="item">
                                            <c:if test="${item.key!='delete'}">
                                                <option value="${item.key}" ${not empty searchInfo && searchInfo.status == item.key ? 'selected' : '' } >${item.value}</option>
                                            </c:if>
                                        </c:forEach>
                                    </select>
                                </div>
                                <div class="ibox-tools ibox-tools-search">
                                    <button type="button" class="btn btn-primary btn-outline" onclick="doRefresh()">查询</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5><i class="fa fa-table"></i> 二级科室</h5>
                        <div class="ibox-tools col-sm-offset-2">
                        <c:if test="${userType == 'super' || not empty btnMap['addSecDept']}">
                            <button class="btn btn-primary btn-outline" onclick="openAddParentDeptPage()">新增</button>
                        </c:if>
                        <c:if test="${userType == 'super' || not empty btnMap['editSecDept']}">
                            <button class="btn btn-primary btn-outline" onclick="openEditParentDeptPage()">编辑</button>
                        </c:if>
                        <c:if test="${userType == 'super' || not empty btnMap['stateSecDept']}">
                            <button class="btn btn-primary btn-outline" onclick="changeParentDeptState()" id="_btnChangeState">恢复</button>
                        </c:if>
                        <c:if test="${userType == 'super' || not empty btnMap['delSecDept']}">
                            <button class="btn btn-primary btn-outline" onclick="checkParentDeptDelete()">删除</button>
                        </c:if>
                        <c:if test="${userType == 'super' || not empty btnMap['exportSecDept']}">
                            <button class="btn btn-primary btn-outline" onclick="doExport()">导出</button>
                        </c:if>
                            <button class="btn btn-primary btn-outline" onclick="goParentPage()">返回</button>
                            <%--<button class="btn btn-primary btn-outline" onclick="doRefresh()">刷新</button>--%>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <iframe id="formIframe" name="formIframeName" style="display:none;"></iframe>
                        <table class='table table-striped table-hover'
                               id="dataTable"  data-height="400"
                               data-toggle="table"
                               data-url="${ctx}/basicDeptInfo/pageFindChildDeptData?t=${now}"
                               data-pagination="true"
                               data-side-pagination="server"
                               data-striped="true"
                               data-response-handler="handleServerResult"
                               data-query-params-type=""
                               data-query-params="getParams"
                               data-page-size="${defaultPageSize}"
                               data-page-list="${pageList}">
                            <thead>
                            <tr>
                                <th data-field="id" data-visible="false">主键id</th>
                                <th data-field="parentCode" data-visible="false">父科室编码</th>
                                <th data-field="deptCode" data-align="center" data-width="180px">科室编码</th>
                                <th data-field="parentDeptName" data-align="center" data-width="180px">所属一级科室</th>
                                <th data-field="deptName" data-formatter="formatName" data-events="actionEvents" data-align="center">二级科室名称</th>
                                <th data-field="shortName" data-align="center">二级科室简称</th>
                                <th data-field="status" data-formatter="formatStatus" data-align="center" data-width="90px">状态</th>
                                <th data-field="sortNum" data-align="center" data-width="90px">排序</th>
                                <th data-field="creator" data-formatter="formatterCreator" data-align="center" data-width="120px">创建人</th>
                                <th data-field="operator" data-formatter="formatterOperator" data-align="center" data-width="120px">编辑人</th>
                            </tr>
                            </thead>
                        </table>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12">
                <div class="text-center">${companyName}</div>
            </div>
        </div>
    </div>
</div>

<div id="editParentDeptModal" class="modal" tabindex="-1" role="dialog" data-backdrop="static" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content animated bounceInRight">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 id="modelTitle" style="font-weight: normal;">新增二级科室</h4>
            </div>
            <div class="modal-body modal-body-height">
                <form class="form-horizontal m-t" id="parentDeptDataForm">
                    <div class="form-group">
                        <label class="col-sm-3 control-label"><span style="color: red">*</span>科室编码：</label>
                        <div class="col-sm-7">
                            <input type="text" id="modalDeptCode" name="modalDeptCode" class="form-control" maxlength="20" required>
                        </div>
                        <div class="col-sm-2 tip"></div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label"><span style="color: red">*</span>所属一级科室：</label>
                        <div class="col-sm-7">
                            <input type="text" id="modalParentDeptName" value="${name}" disabled="disabled" name="modalParentDeptName" class="form-control" maxlength="20">
                        </div>
                        <div class="col-sm-2 tip"></div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label"><span style="color: red">*</span>科室名称：</label>
                        <div class="col-sm-7">
                            <input type="text" id="modalDeptName" name="modalDeptName" class="form-control" maxlength="20" required>
                        </div>
                        <div class="col-sm-2 tip"></div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label"><span style="color: red"></span>科室简称：</label>
                        <div class="col-sm-7">
                            <input type="text" id="modalShortName" name="modalShortName" class="form-control" maxlength="20">
                        </div>
                        <div class="col-sm-2 tip"></div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">排序：</label>
                        <div class="col-sm-7">
                            <input type="text" id="modalSortNum" name="modalSortNum" class="form-control" maxlength="9" isPInteger="true">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">备注：</label>
                        <div class="col-sm-7">
                            <textarea type="text" id="modalRemark" name="modalRemark" class="form-control" maxlength="200" style="height: 100px; resize: none;" placeholder="200字以内"></textarea>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer" style="text-align: center;">
                <button class="btn btn-primary" onclick="doSaveParentDept()">保存</button>
                <button class="btn btn-white" onclick="closeEditParentDeptModal();">返回</button>
            </div>
        </div>
    </div>
</div>

<div id="parentDeptInfoModal" class="modal" tabindex="-1" role="dialog" data-backdrop="static" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content animated bounceInRight">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 style="text-align: center; font-weight: normal;">二级科室详情</h4>
            </div>
            <div class="modal-body modal-body-height">
                <form class="form-horizontal m-t" id="parentDeptDataForm1" novalidate="novalidate">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">科室编码：</label>
                        <label class="col-sm-7 control-label control-label-content" id="lab_deptCode"></label>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">所属一级科室：</label>
                        <label class="col-sm-7 control-label control-label-content" id="lab_parentDeptName">${name}</label>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">科室名称：</label>
                        <label class="col-sm-7 control-label control-label-content" id="lab_deptName"></label>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">科室简称：</label>
                        <label class="col-sm-7 control-label control-label-content" id="lab_shortName"></label>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">排序：</label>
                        <label class="col-sm-7 control-label control-label-content" id="lab_sortNum"></label>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">备注：</label>
                        <label class="col-sm-7 control-label control-label-content" id="lab_remark"></label>
                    </div>
                </form>
            </div>
            <div class="modal-footer" style="text-align: center;">
                <button class="btn btn-white" onclick="closeParentDeptInfoModal();">返回</button>
            </div>
        </div>
    </div>
</div>

<script src="${ctx}/js/dept/childDeptMgr.js?t=${now}"></script>
</body>
</html>
